import {
    createStore,    //创建store
    applyMiddleware, //中间件处理异步action
    combineReducers  //合并多个reducer
} from "redux";  

import countReducer from './reducers/countReducer' //引入Count组件的reducer
import movieReducer from './reducers/movieReducer' //引入Movie组件的reducer


//异步处理中间件
//当我们要进行异步action，action是一个函数，我们dispacth的函数就会提交到中间件
//中间件帮我们执行函数，一般函数中会有一个dispatch再次派发到store中
import thunk from 'redux-thunk'


//合并多个reducer
const allReducer = combineReducers({
    count: countReducer,
    movie: movieReducer
})

//创建store 并提供对应的reducer
const store = createStore(allReducer , applyMiddleware(thunk));

export default store;